<?php

include_once "Model.php";

class User2Fav_ extends Model {

    public function User2Fav_($attr=null){ $this->table_name = USER2FAV_TABLE; parent::__construct($attr); }
    
    public function getPlayList(){
      $query = "SELECT t.id, t.url,t.title ,a.name AS artist, r.title as release_title " .
          "FROM (mt_user2fav u2f, mt_track t,mt_artist a) LEFT JOIN mt_release r ON (t.release_id = r.id)  " .
          "WHERE u2f.user_id = {$this->attributes['user_id']} AND t.id=u2f.track_id AND a.id=t.artist_id ORDER BY u2f.id DESC";
      //echo $query; 
      $this->SQL->query($query);
      $result = array();
        
      while(($track = $this->SQL->fetchObject())){
      	array_push($result, $track);
      }
      
      return $result;
    }

}


?>
